﻿using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class LV2Player : MonoBehaviour {

	public InputControlCenter inputCtrl;

	protected Animator animator;
	protected LV2CharaAction chAct;
    public event EventHandler<SingEventArg> evtPlayerSing;

	// Use this for initialization
	void Start () {
		animator = GetComponent<Animator>();
		chAct = GetComponent<LV2CharaAction>();

		inputCtrl.evtUserInput += new System.EventHandler<InputEventArgs> (OnInputEvent);
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	public void OnInputEvent(object send, InputEventArgs args)
	{
		if (args.Action == InputAction.PressDown){
			chAct.singA();
		}
		
		if (args.Action == InputAction.RaiseUp) {
			chAct.Shutup();
		}
		
		if (args.Action == InputAction.SliderUp) {
			chAct.singB();
		}
	}

	public enum SingAction{
		singA,singB,shutup
	}



    public class SingEventArg : EventArgs
    {
        public SingEventArg(SingAction act)
        {
            action = act;
        }
        private SingAction action;

        public SingAction Singing
        {
            get { return action; }
            set { action = value; }
        }
    }



}
